package com.shenjinzheng.base.listeners;

import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

@Component
public class amqpListener {

    @RabbitListener(bindings = @QueueBinding(
            value = @Queue(value = "direct_queue1"),
            exchange = @Exchange(value = "direct_exchange"),
            key = {"sms","both"}
    ))
    public void listen3(String msg) {
        System.out.println("短信消息：" + msg);
    }

    @RabbitListener(bindings = @QueueBinding(
            value = @Queue(value = "direct_queue2"),
            exchange = @Exchange(value = "direct_exchange"),
            key = {"email","both"}
    ))
    public void listen4(String msg) {
        System.out.println("邮箱消息：" + msg);
    }


}
